<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />

<script  type="text/javascript" src="../../resource/js/zepto.min.js"></script>
 <link rel="stylesheet" href="../../resource/frozen/css/frozen.css">
 <script src="../../resource/frozen/js/frozen.js"></script>
   <script src="../../resource/js/result.js"></script>
<script src="../../resource/js/common.js"></script>
<script src="../../resource/js/template.js"></script>
<script src="../../resource/js/pageTemplate.js"></script>
<script src="../../resource/js/phoneTip.js"></script>

 <script type="text/javascript">
 function index(){
		location.href="/ydtu/weixin/index.htm";
 }
 </script>
<title>停车一道通</title>
</head>
<body >
<header class="ui-header ui-header-positive ui-border-b">
            <i class="ui-icon-return" onclick="history.back()"></i><h1>支付</h1><!-- <button class="ui-btn" onclick="index()">首页</button> -->
        </header>	

	
</body>
<script type="text/javascript">

// 		var orderId=getQueryString("orderId");
		var orderId=localStorage.orderId;
		localStorage.removeItem("orderId");
		$.ajax({
			url:linkPre+"/ydtu/weixinPay.htm",
			type:"post",
			data:{"orderId":orderId},
			dataType:"json",
			success:function(data){
				checkResult_weixin(data.result);
				if(data.result==SUCCESS){
					onBridgeReady(data.data.appId,data.data.timeStamp,data.data.nonceStr,data.data.package2,data.data.paySign)		
				}
				
			}
		});
function onBridgeReady(appId,timeStamp,nonceStr,package2,paySign){
	  WeixinJSBridge.invoke(
     'getBrandWCPayRequest', {
         "appId" : appId,     //公众号名称，由商户传入     
         "timeStamp":timeStamp,         //时间戳，自1970年以来的秒数     
         "nonceStr" : nonceStr, //随机串     
         "package" : package2,     
         "signType" : "MD5",         //微信签名方式:     
         "paySign" : paySign //微信签名 
     },
     function(res){
         if(res.err_msg == "get_brand_wcpay_request:ok" ) {
        	 
        	 alert("支付成功");
      	     location.href="infomation.html";
         }     // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。 
         else{
        	 $.tips({
        	        content:'未支付',
        	        stayTime:1000,
        	        type:"warn"
        	    })
         }
     }
 );  
}

</script>
</html>